<?php

/**
 * This is the model class for table "tbl_rel_ingreso_documentacioningreso".
 *
 * The followings are the available columns in table 'tbl_rel_ingreso_documentacioningreso':
 * @property integer $indi_periodoingreso_id
 * @property integer $indi_programaacademico_id
 * @property integer $indi_documentacioningreso_id
 * @property integer $indi_requeridacursoingreso
 * @property integer $indi_requeridacursar
 * @property integer $indi_opcional
 */
class IngresoDocumentacionIngreso extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return IngresoDocumentacionIngreso the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_rel_ingreso_documentacioningreso';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('indi_periodoingreso_id, indi_programaacademico_id, indi_documentacioningreso_id, indi_requeridacursoingreso, indi_requeridacursar, indi_opcional', 'required'),
			array('indi_periodoingreso_id, indi_programaacademico_id, indi_documentacioningreso_id, indi_requeridacursoingreso, indi_requeridacursar, indi_opcional', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('indi_periodoingreso_id, indi_programaacademico_id, indi_documentacioningreso_id, indi_requeridacursoingreso, indi_requeridacursar, indi_opcional', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'documentacion' => array(self::BELONGS_TO, 'DocumentacionIngreso', 'indi_documentacioningreso_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'indi_periodoingreso_id' => 'Indi Periodoingreso',
			'indi_programaacademico_id' => 'Indi Programaacademico',
			'indi_documentacioningreso_id' => 'Indi Documentacioningreso',
			'indi_requeridacursoingreso' => 'Indi Requeridacursoingreso',
			'indi_requeridacursar' => 'Indi Requeridacursar',
			'indi_opcional' => 'Indi Opcional',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('indi_periodoingreso_id',$this->indi_periodoingreso_id);
		$criteria->compare('indi_programaacademico_id',$this->indi_programaacademico_id);
		$criteria->compare('indi_documentacioningreso_id',$this->indi_documentacioningreso_id);
		$criteria->compare('indi_requeridacursoingreso',$this->indi_requeridacursoingreso);
		$criteria->compare('indi_requeridacursar',$this->indi_requeridacursar);
		$criteria->compare('indi_opcional',$this->indi_opcional);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}